﻿#include <string>
#include <map>
#include <functional>

namespace Network
{
	enum class NetWorkCode
	{
		NetWorkCode_success = 200,
		NetWorkCode_Error = 403
	};

	struct NetWorkStatus
	{
		NetWorkCode code;
	};

	using NetWorkSuccess = std::function<void(const std::string&)>;
	using NetWorkError = std::function<void(const NetWorkStatus&)>;
	using QueryParams = std::map<std::string, std::string>;

	enum class RequestMethoad
	{
		GET = 0,
		POST = 1
	};

	// TODO: add timeout, failed try
	void request(const std::string url, RequestMethoad methoad, const QueryParams& params, NetWorkSuccess success = NetWorkSuccess(), NetWorkError error = NetWorkError());
}